package com.matt.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.matt.foundation.model.Domain;
import com.matt.foundation.model.Model;
import com.matt.foundation.retention.FieldMeta;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

/**
 * *******************************
 * description：线索跟进
 * Created by Ron.
 * form com.matt
 * on 2018/6/12
 * *******************************
 */
@Entity
@Table(name = "leads_history")
@Data
@EqualsAndHashCode(callSuper = true)
public class LeadsHistory extends Domain{

    @Column(columnDefinition = "int default 0 COMMENT '跟进方式 1：电话  2：微信 3：邮件  4：短信 5：拜访 6：QQ  7:其他'")
    private String channel;

    @Column(columnDefinition = "int default 0 COMMENT ' 线索跟进状态  1:未处理  2：初访->(沟通中) 3：已邀约 4：已到访  5：不感兴起  6：未接通  7：地域不符 8：孩子超龄 9：无效的联系方式'")
    private Integer leadsStatus=0;

    @Column(columnDefinition = "int default 0 COMMENT ' 客户状态  1:新分配  2：首访 3：上门 4：试听  5：试托  6：签单  7：续费 8：无效 9.成交'")
    private Integer clientStatus;

    @Column(columnDefinition = "int default 0 COMMENT ' 客户跟进状态  1:未处理->(沟通中)  2：已预约->(已邀约) 3：已到访 4：已完成申请表  5：已面试  6：已交定金  7：面试不通过 8：方案不满意 9：园区不满意  10：无支付能力 '")
    private Integer clienteleStatus=0;

    @Column(columnDefinition = "varchar(32) COMMENT '跟进类型  leads:线索跟进    clientele:客户跟进 '")
    private String type;

    @Column(columnDefinition = "varchar(50) COMMENT '日志操作类型  create:创建  update :修改  delete:删除 transfer:转移 upload :上传  follow :跟进 '")
    private String operationType;

    @Column(columnDefinition = "longtext COMMENT '跟进内容'")
    private String content;

    @Column(columnDefinition = "datetime COMMENT '实际跟进进时间'")
    private Date actualFollowDate;

    @Column(columnDefinition = "datetime COMMENT '下次跟进时间'")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date nextTime;

    @Column(columnDefinition = "longtext COMMENT '图片url'")
    private  String imgUrl;

    @Column(columnDefinition = "longtext COMMENT '附件url'")
    private String attachmentUrl;

    @Column(columnDefinition = "varchar(32) COMMENT '线索id'")
    private String leadsId;

    @Column(columnDefinition = "varchar(32) COMMENT '客户id'")
    private String clientelesId;

    @Column(columnDefinition = "varchar(32) COMMENT '所属园区'")
    private String areaId;

    @Column(columnDefinition = "varchar(32) COMMENT '员工id'")
    private String staffId;

    //用户头像  （冗余字段）
    @Column(columnDefinition = "varchar(255) COMMENT '员工头像'")
    private String staffHeadImgUrl;

    //员工姓名  （冗余字段）
    @Column(columnDefinition = "varchar(255) COMMENT '员工姓名'")
    private String staffName;

    @Column(columnDefinition = "int(1) DEFAULT '0' COMMENT '是否试托，默认为0,0=否'")
    private Integer isPallet;

    @Column(columnDefinition = "int(1) DEFAULT '0' COMMENT '是否到访，默认为0,0=否'")
    private Integer isVisit;

    @Column(columnDefinition = "datetime DEFAULT NULL COMMENT '试托时间'")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date palletTime;

    @Column(columnDefinition = "datetime DEFAULT NULL COMMENT '到访时间'")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date visitTime;

    @Column(columnDefinition = "varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '备注'")
    private String remark;

    @Transient
    private Integer rankp;

    @Transient
    private Integer status; //客户跟进状态

    @Transient
    private String statusVal; //客户跟进状态值

    @Transient
    private Integer signStatus; //客户成交状态




}
